<template>
  <div class="onePlus wrapper">
    <swiper :banners="banners"></swiper>
    <tab-category :categorys="categorys"/>
    <template v-for="category in categorys" :key="category.id">
      <section-title :title="category?.title"/>
      <!-- 使用了可选链 当为空时默认不展示组件     -->
      <grid-view :productDetailss="category?.productDetailss" :category-url="category?.url"/>
    </template>

  </div>
</template>

<script setup lang="ts">
import {storeToRefs} from 'pinia'
import useHomeStore from '~/store/home';

const homeStore = useHomeStore();
homeStore.fetchHomeData('intelligent')
const {navbars, banners, categorys} = storeToRefs(homeStore)
console.log("=>(index.vue:19) categorys", categorys.value);
console.log("=>(index.vue:19) banners", banners.value);
console.log("=>(index.vue:19) navbars", navbars.value);

</script>

<style lang="scss" scoped>
.onePlus {
  /* color: red; */
}
</style>
